package cn.highedu.dubboclinetdemo.demos;

import cn.highedu.service.DemoService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DubboClientController {

    private Logger logger = org.slf4j.LoggerFactory.getLogger(DubboClientController.class);

    @DubboReference
    private DemoService demoService;

    @GetMapping("/dubbo/hello/{name}")
    public String sayHello(@PathVariable String name) {
        logger.info("Dubbo Client sayHello() is called");
        return demoService.sayHello(name) + " from Dubbo Client";
    }
}
